home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 10601 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.8 KB

  1. Path: chronicle.mti.sgi.com!news
  2. From: austern@isolde.mti.sgi.com (Matt Austern)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Will JAVA kill C++?
  5. Date: 08 Mar 1996 20:14:19 GMT
  6. Organization: SGI
  7. Message-ID: <AUSTERN.96Mar8121419@isolde.mti.sgi.com>
  8. References: <313E44EA.14D110C0@netcom.com> <4hp18v$3di@frodo.smartlink.net>
  9.     <4hq2j6$q93@galaxy.ucr.edu>
  10. Reply-To: austern@mti.sgi.com
  11. NNTP-Posting-Host: isolde.mti.sgi.com
  12. In-reply-to: thp@cs.ucr.edu's message of 8 Mar 1996 19:42:30 GMT
  13.  
  14. In article <4hq2j6$q93@galaxy.ucr.edu> thp@cs.ucr.edu (Tom Payne) writes:
  15.  
  16. > : I still think the C++ program would be quicker and more efficient -- There
  17. > : are still some things you will not be able to do in JAVA, such as
  18. > : pointers.  And anyone who believes arrays can do anything a real pointer
  19. > : can does not know what they are talking about and probably does not know
  20. > : how to program very well.
  21. > When one is interested in speed, one should avoid pointers (as
  22. > does. Fortran), since pointers kill opportunities for optimization.
  23.  
  24. The problem with Java isn't that it has no pointers, but, rather, that
  25. it makes it impossible to avoid pointers.  All references to primitive
  26. types in Java are by value (i.e., not using pointers), and all
  27. references to class types are by reference (i.e., using pointers).
  28.  
  29. In C++, or Fortran, or Eiffel, you can have an array of complex
  30. numbers.  In Java, though, you can't: you can have something that
  31. looks like an array of complex numbers, but internally it's really an
  32. array of pointers to complex numbers.  You have to pay a space penalty
  33. to store those pointers, and a time penalty to do the dereferencing on
  34. every element, and the optimizer will have to generate code on
  35. assumption that two array elements might point to the same object.
  36. -- 
  37. Matt Austern
  38. SGI: MTI Compilers Group
  39. austern@isolde.mti.sgi.com
  40.